package cn.epsilon3.service.impl;

import cn.hutool.core.util.ObjectUtil;
import cn.epsilon3.domain.e3.po.E3BlackIpPo;
import cn.epsilon3.mybatis.service.E3BlackIpMapperService;
import cn.epsilon3.service.E3BlackIpService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @description 黑名单ip服务
 *
 * @author: epsilon3
 * @date: 2023/9/6 17:30
 */
@Service
public class E3BlackIpServiceImpl implements E3BlackIpService {

    @Resource
    private E3BlackIpMapperService e3BlackIpMapperService;

    @Override
    public void saveBlackIp(E3BlackIpPo e3BlackIpPo) {
        E3BlackIpPo blackIpPo = e3BlackIpMapperService.selectOne(e3BlackIpPo.getIp());
        if (ObjectUtil.isNull(blackIpPo)) {
            e3BlackIpMapperService.insertOne(e3BlackIpPo);
        }
    }
}
